

	(function($){
		$.fn.extend({
			ND_select : function(option){
				var defaults = {
					ND_select_name : '',  //提交到input的name
					ND_select_class : '',  //
					ND_select_val : '',
					ND_select_hover_class : ''
				};
				var o = $.extend(defaults,option);
				return this.each(function(){
					var $this = $(this);
					$this.addClass(o.ND_select_class);
					$this.children('ul').hide();
					$this.children('div').click(function(){
						$(this).css('border','1px solid #ddd');
						if($this.children('ul').css("display") == 'none'){
							if ($this.children('ul').height() > 300){
								$this.children('ul').height(300);
								$this.children('ul').css({
									'height' : '300px',
									'overflow' : 'auto'
								});
							}
							$this.children('ul').slideDown('fast');
						}else{
							$this.children('ul').slideUp('fast');
						}
					});
					
					$this.hover(function(){},function(){
						if ($(this).children('ul').css("display") == 'block'){
							$(this).children('ul').slideUp('fast');
						}
					});
					
					//Select Event
					$this.children().children('li').click(function(){
						$this.children('div.pselect').text($(this).text());
						if ($('input[name="' + o.ND_select_name + '"]').length > 0){
							$('input[name="' + o.ND_select_name + '"]').val($(this).attr("type"));
						}else{
							$this.children('ul').after('<input name="' + o.ND_select_name +'" value="' + $(this).attr("type") + '" type="hidden" />');
						}
						$this.children('ul').hide();
					});
					
					//鼠标效果
					$this.children('ul').children('li').hover(function(){
						$(this).addClass(o.ND_select_hover_class);
					},function(){
						$(this).removeClass(o.ND_select_hover_class);
					});
				});
			}
		});
	})(jQuery);
